// 泛型函数 命名函数
function fn<T>(arg: T): T {
  return arg
}
const res: number = fn<number>(7)
console.log(res)

// 泛型函数 匿名函数
const fn2: <T>(arg: T) => T = arg => arg
const res2: number = fn2<number>(7)
console.log(res2)

// 泛型函数 成员方法
let obj: {
  fn<T>(arg: T): T
  fn2: <T>(arg: T) => T
} = {
  fn: arg => arg,
  fn2: arg => arg
}
const res3: number = obj.fn<number>(7)
console.log(res3)
const res4: number = obj.fn2<number>(7)
console.log(res4)

export {}
